// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
//import App from './App'/
import router from './router'
import Home from './components/page/home'
import 'element-ui/lib/theme-chalk/index.css';
import '../static/css/base.css';
import '../static/js/tag'
import {
	Carousel,
	CarouselItem,
	Message,
	Button
  } from 'element-ui';
  
 
  Vue.use(Carousel);
  Vue.use(CarouselItem);
  Vue.use(Button)
  Vue.prototype.$message = Message;


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	beforeCreate: function () {
			document.body.style.zoom = "normal"; //避免zoom尺寸叠加
			let scale = document.body.clientWidth / 1904;
			document.body.style.zoom = scale;
			//防抖，避免resize占用过多资源
			;
		(function () {
			var throttle = function (type, name, obj) {
				obj = obj || window;
				var running = false;
				var func = function () {
					if (running) {
						return;
					}
					running = true;
					requestAnimationFrame(function () {
						obj.dispatchEvent(new CustomEvent(name));
						running = false;
					});
				};
				obj.addEventListener(type, func);
			};
	
			throttle("resize", "optimizedResize");
		})();
	
		window.addEventListener("optimizedResize", function () {
			document.body.style.zoom = "normal";
			let scale = document.body.clientWidth / 1904;
			document.body.style.zoom = scale;
		});
	},
	components: {
		Home
	},
	template:`<router-view></router-view>`
})